/* 隐藏代理导航容器 */
#timeline-proxy { position: absolute; left: -99999px; width: 1px; height: 1px; overflow: hidden; }
#timeline-proxy .carousel-cell { width: 8px; height: 8px; }

/* 基础重置和变量 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #FFFF;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
    --transition: all 0.3s ease;
    --overlay-duration: 300ms; /* image-overlay 入场时长，divider 动画延迟将对齐它 */
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 20px;
    --spacing-lg: 40px;
    --spacing-xl: 60px;
    --slide-gap: 80px;
    /* 主相册固定高度，基于此按3:2计算固定宽度 */
    --main-slide-height: 390px;
    --timeline-line-color: #eb0000;
    --timeline-line-width: 2px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
}

/* 相册容器 */
.album-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 主相册样式 - 基于原版设计 */
.main-carousel {
    width: 100%; /* 对应原版固定宽度 */
    height: calc(var(--main-slide-height) + 80px);
    margin: 0 auto;
    padding: 40px 0 0;
    position: relative;
    overflow: visible;
}

/* 3D 透视：让 rotateY 有纵深 */
.main-carousel .flickity-viewport {
    perspective: 1000px;
    display: flex;
    align-items: flex-end;
    height: var(--main-slide-height);
}
/* 让带有 transform 的中间祖先保留3D：避免子元素3D被扁平化 */
.main-carousel .flickity-slider {
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    display: flex !important;
    align-items: flex-end;
    height: var(--main-slide-height);
}


/* 确保图像容器作为3D承载层 */
/* 允许3D在Flickity内部传递，避免子元素被扁平化 */
.main-carousel .flickity-slider { transform-style: preserve-3d; }
.main-carousel .carousel-cell { transform-style: preserve-3d; }

/* 更稳的旋转中心 */
.main-carousel .image-container { transform-origin: bottom center; }

.main-carousel .image-container {
    transform-style: preserve-3d;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}
/* 主相册单元格 - 基于原版Swiper配置（保持3:2比例） */
.main-carousel-cell {
    width: calc(var(--main-slide-height) * 1.5) !important;
    min-width: calc(var(--main-slide-height) * 1.5) !important;
    max-width: calc(var(--main-slide-height) * 1.5) !important;
    height: var(--main-slide-height) !important;
    min-height: var(--main-slide-height) !important;
    max-height: var(--main-slide-height) !important;
    aspect-ratio: 3 / 2;
    margin: 0 calc(var(--slide-gap) / 2);
    position: relative;
    flex-shrink: 0;
    padding: 0;
    display: flex;
    align-items: flex-end;
}

/* 图片容器 */
.image-container {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.image-container:hover {
    box-shadow: var(--shadow-hover);
    transform: none;
}

/* 内部图片容器占满单元，并用 cover 以短边适应填充 */
.main-carousel-cell .image-container,
.main-carousel-cell .carousel-image { width: 100%; height: 100%; }
.main-carousel-cell .carousel-image { object-fit: cover; }

/* 主相册：Hover 推开效果（对子容器做位移，避免与 Flickity 冲突） */
.main-carousel-cell .image-container { transition: transform 180ms ease; }
.main-carousel-cell.push-left .image-container,
.main-carousel-cell.push-right .image-container,
.main-carousel-cell.push-left-far .image-container,
.main-carousel-cell.push-right-far .image-container {
    transform: translateX(0);
}

/* 相册图片 */
.carousel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

/* 图片叠加层 */
.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white !important;
    padding: var(--spacing-md);
    transform: translateY(100%);
    transition: var(--transition);
}

.main-carousel-cell.is-selected .image-container:hover .image-overlay {
    transform: translateY(0);
}

.image-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: white;
}

.image-year {
    font-size: 0.9rem;
    opacity: 0.9;
    background: var(--accent-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}


/* 模块A：叠加层分隔线强制样式（提高优先级，确保可见） */
.image-overlay .image-info .image-title-divider {
    display: block;
    width: 25px;
    height: 4px;
    background: #e53935;
    margin: 8px 0 12px;
}

@media (max-width: 768px) {
    .image-overlay .image-info .image-title-divider {
        width: 90px; height: 3px;
    }
}

/* 叠加文字信息样式：标题-红色短线-简介 */
.image-info { width: 100%; max-width: 100%; }

.image-title-divider {
    width: 25px;
    height: 4px !important;
    background: #e53935; /* 红色短线 */
    margin: 8px 0 12px 0;
}
.image-desc {
    width: 100%;
    display: block;
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.95);
    text-shadow: 0 1px 1px rgba(0,0,0,0.35);
    margin: 0;
}

/* 模块B：红色短线长度入场动画（与 overlay 入场对齐） */
.image-overlay .image-info .image-title-divider {
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 200ms ease 0ms; /* 基态无延迟，hover out 动画无延迟开始收起 */
    will-change: transform;
}
/* hover 进入：在 overlay 完成后再开始拉伸（延迟等于 --overlay-duration） */
.image-container:hover .image-overlay .image-info .image-title-divider {
    transform: scaleX(1);
    transition: transform 200ms ease var(--overlay-duration);
}


@media (max-width: 768px) {
    .image-info { width: 100%; max-width: 100%; }
    .image-title-divider { width: 90px; height: 3px; }
    .image-desc { font-size: 0.9rem; }
}



/* 加载占位符：整张幻灯片骨架占位（横向灰色渐变闪动） */
.loading-placeholder {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    overflow: hidden;
    background: linear-gradient(90deg,
        rgba(0,0,0,0.06) 25%,
        rgba(0,0,0,0.12) 37%,
        rgba(0,0,0,0.06) 63%
    );
    background-size: 400% 100%;
    animation: shimmer 1.2s ease-in-out infinite;
    transition: opacity 0.3s ease;
}

/* 未加载时可见，占位层透明度控制 */
.carousel-image[data-flickity-lazyload] + .image-overlay + .loading-placeholder { opacity: 1; }
.carousel-image.flickity-lazyloaded + .image-overlay + .loading-placeholder {
    opacity: 0;
    pointer-events: none;
}

/* 骨架闪动动画 */
@keyframes shimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

/* 时间轴导航 - 完全按照原版navSwiper设计 */
.timeline-nav {
    width: 100%; /* 对应原版全宽978.67px */
    height: 120px; /* 对应原版高度 */
    background: transparent;
    position: relative;
    overflow: hidden;
    margin: 7vh 0 0;
}

/* 时间轴贯穿的灰色细线 */
.timeline-nav::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: var(--timeline-line-width);
    background-color: var(--timeline-line-color);
    z-index: 0;
    transform: translateY(-50%);
}

.timeline-cell {
    height: 120px; /* 对应原版高度 */
    padding: 0; /* 对应原版无padding */
    cursor: pointer;
    /* 避免 Flickity 重排时产生“回滚/追加”的位移动画，只保留颜色相关过渡 */
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.3s ease;
    position: relative;
    flex-shrink: 0; /* 防止压缩 */
    margin-right: 0; /* 对应原版无间距 */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1; /* 默认非激活状态透明度 */
    /* 宽度由Flickity响应式配置控制 */
}

/* 时间轴内容 - 按照原版设计实现红色圆形背景 */
.timeline-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.timeline-item {
    width: 120px;
    height: 120px;
    margin: -5px 0 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-top {
    width: 96px;
    height: 96px;
    background: #fff;
    border: var(--timeline-line-width) dashed var(--timeline-line-color);
    border-radius: 100%;
    color: var(--timeline-line-color);
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.timeline-top::before {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    border: var(--timeline-line-width) solid var(--timeline-line-color);
    background: #fff;
    transition: transform 0.3s ease, background 0.3s ease;
    z-index: 0;
}

.timeline-year-text {
    margin: 0;
    line-height: 1;
    font-weight: bold;
    position: relative;
    z-index: 1;
}

.timeline-year-text::after {
    content: '年';
    font-size: 0.6em;
    margin-left: 2px;
}

/* 移除不需要的元素 */
.timeline-thumbnail,
.timeline-thumb-image,
.timeline-count {
    display: none;
}

/* 时间轴激活状态 - 完全按照原版红色圆形背景设计 */
.timeline-indicator {
    display: none; /* 原版没有指示器 */
}

/* Flickity激活状态样式 - 红色圆形背景 */
.timeline-cell.is-selected {
    opacity: 1; /* 激活状态完全不透明 */

}

.timeline-cell.is-selected .timeline-top {
    width: 112px;
    height: 112px;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
}

.timeline-cell.is-selected .timeline-top::before {
    inset: 12px;
    background: var(--timeline-line-color);
    transform: scale(1.08);
}

.timeline-cell:hover .timeline-top {
    color: #fff;
    font-size: 18px;
    transform: scale(1.05);
}

.timeline-cell:hover .timeline-top::before {
    transform: scale(1.18);
    background: var(--timeline-line-color);
}

.timeline-cell.is-selected:hover .timeline-top::before {
    transform: scale(1.22);
}

/* 非激活状态：白色不透明小圆背景 */
.timeline-cell:not(.is-selected) .timeline-top {
    color: var(--timeline-line-color);
    font-weight: 500;
    z-index: 2;
    position: relative;
    cursor: pointer;
    font-size: 16px;
}

.timeline-cell:not(.is-selected):hover .timeline-top {
    color: #fff;
}

.timeline-cell:hover .timeline-year-text {
    color: #fff;
}

/* 响应式配置 - 对应原版Swiper breakpoints */
/* 320px: slidesPerView: 3 */
@media (max-width: 768px) {
    .timeline-cell {
        width: calc(100% / 3); /* 显示3个年份 */
    }
}

/* 500px: slidesPerView: 5 */
@media (min-width: 768px) and (max-width: 1199px) {
    .timeline-cell {
        width: calc(100% / 5); /* 显示5个年份 */
    }
}

/* 1200px: slidesPerView: 7 */
@media (min-width: 1200px) {
    .timeline-cell {
        width: calc(100% / 7); /* 显示7个年份 */
    }
}

/* 年份修饰符样式 */
.year-2007 { --year-color: #e74c3c; }
.year-2012 { --year-color: #f39c12; }
.year-2013 { --year-color: #f1c40f; }
.year-2014 { --year-color: #2ecc71; }
.year-2016 { --year-color: #1abc9c; }
.year-2017 { --year-color: #3498db; }
.year-2018 { --year-color: #9b59b6; }
.year-2019 { --year-color: #e91e63; }
.year-2020 { --year-color: #ff5722; }
.year-2021 { --year-color: #795548; }
.year-2023 { --year-color: #607d8b; }
.year-2024 { --year-color: #34495e; }


/* Flickity自定义样式 - 基于原版设计 */

.flickity-button {
    background: transparent;
    border: none;
    color: #fff;
    width: 56px;
    height: 56px;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    backdrop-filter: blur(12px);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    z-index: 10;
}

.flickity-button:hover {
    background: #fff;
    color: #eb0000;
    border: none;
    box-shadow: 0 4px 16px rgba(235, 0, 0, 0.2);
}

.flickity-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.flickity-button-icon {
    fill: currentColor;
    width: 22px;
    height: 22px;
}

/* 主相册按钮位置 - 对应原版位置 */
.main-carousel .flickity-prev-next-button {
    top: 50%;
    transform: translateY(-40px); /* 对应原版transform */
}

.main-carousel .flickity-prev-next-button.previous {
    left: 20px; /* 添加内边距 */
}

.main-carousel .flickity-prev-next-button.next {
    right: 20px; /* 添加内边距 */
}

/* 自定义SVG图标以匹配原版 */
.flickity-button svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: currentColor;
}

/* 隐藏时间轴的翻页按钮 */
.timeline-nav .flickity-prev-next-button {
    display: none;
}

/* 隐藏主相册的页面指示器 */
.main-carousel .flickity-page-dots {
    display: none;
}

/* 响应式设计 - 移动端 */
@media (max-width: 768px) {
    .main-carousel {
        height: auto;
        min-height: 0;
    }

    /* 移动端显示1张图片，100%宽度 */
    .main-carousel-cell {
        width: 100% !important;
        height: auto !important;
        margin: 0; /* 移除间距，确保100%宽度 */
        padding: 0;      /* 移除内边距，真正贴边 */
    }
    .main-carousel-cell .image-container {
        width: 100%;
        height: auto;
        aspect-ratio: 3 / 2;
    }


    .timeline-thumbnail {
        width: 50px;
        height: 35px;
    }

    .timeline-year-text {
        font-size: 0.8rem;
    }

    .timeline-count {
        font-size: 0.7rem;
    }

    .image-title {
        font-size: 1rem;
    }

    .main-carousel .flickity-prev-next-button {
        width: 40px;
        height: 40px;
    }

    .main-carousel .flickity-prev-next-button.previous {
        left: var(--spacing-sm);
    }

    .main-carousel .flickity-prev-next-button.next {
        right: var(--spacing-sm);
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .main-carousel {
        height: auto;
        min-height: 0;
    }


    .timeline-thumbnail {
        width: 40px;
        height: 30px;
    }

    .timeline-year-text {
        font-size: 0.75rem;
    }

    .timeline-count {
        display: none;
    }

    .image-overlay {
        padding: var(--spacing-sm);lay
    }

    .image-title {
        color: white;
        font-size: 0.9rem;
    }
    
}

/* 加载和错误状态 */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #ddd;
    border-top: 4px solid var(--secondary-color);
    animation: spin 1s linear infinite;
    margin-bottom: var(--spacing-md);
}

.error-message {
    text-align: center;
    padding: var(--spacing-xl);
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 400px;
    margin: 0 auto;
}

.error-message h3 {
    color: var(--accent-color);
    margin-bottom: var(--spacing-sm);
}

.retry-button {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    cursor: pointer;
    margin-top: var(--spacing-sm);
    transition: var(--transition);
}

.retry-button:hover {
    background: #2980b9;
}

/* 空状态和错误状态样式 */
.loading-cell,
.error-cell,
.empty-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-light);
}

.loading-content,
.error-content,
.empty-content {
    padding: var(--spacing-lg);
}

.error-icon,
.empty-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #ddd;
    border-top: 3px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

/* 时间轴错误状态 */
.timeline-error,
.timeline-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light);
    font-style: italic;
}

/* 高对比度和可访问性 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 打印样式 */
@media print {
    .flickity-button,
    .timeline-nav {
        display: none;
    }

    .main-carousel {
        height: auto;
    }

    .main-carousel-cell {
        width: 100%;
        page-break-inside: avoid;
        margin-bottom: var(--spacing-md);
    }
}
